<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <div class="field"></div>
    <button id="btn">
        click !
    </button>
</head>
<body>
<script>
    let btn=document.querySelector('#btn')
    let f=document.querySelector('.field')
    let ws=new WebSocket('ws://localhost:8282/zut-software/websocketNotify')
    console.log(ws.readyState)
    ws.onopen=()=>{
        f.innerHTML='hello'
    }
    ws.onmessage=(event)=>{
        document.write(event.data)
    }
    btn.addEventListener('click',()=>{
        ws.send('message')
    })
</script>
</body>
</html>